(deftemplate animal (slot nume)(slot sex)(slot inaltime))
(deftemplate arca (slot pozitie)(slot nume))

(deffacts myFacts
    (animal(nume soarece)(sex m)(inaltime 1))
    (animal(nume soarece)(sex f)(inaltime 2))
    (animal(nume veverita)(sex m)(inaltime 3))
    (animal(nume veverita)(sex f)(inaltime 4))
    (animal(nume pisica)(sex m)(inaltime 5))
    (animal(nume pisica)(sex f)(inaltime 6))
    (animal(nume caine)(sex m)(inaltime 7))
    (animal(nume caine)(sex f)(inaltime 8))
    (animal(nume vaca)(sex m)(inaltime 9))
    (animal(nume vaca)(sex f)(inaltime 10))
    (animal(nume elefant)(sex m)(inaltime 11))
    (animal(nume elefant)(sex f)(inaltime 12))
    )
(defglobal ?*contor* = 1)
(defrule asezareArca
    ?id <- (animal (nume ?n) (inaltime ?i)) 
    =>
    (assert (arca (pozitie ?*contor*) (nume ?n)))
    (++ ?*contor*)
    (printout t "Animale sunt " ?n)
)

(facts)
(run)